import { ApiCall } from "tsrpc";
import { ReqUseAttBook, ResUseAttBook } from "../../../../shared/master/bag/function/PtlUseAttBook";
import { player } from "../../../../model/fight/body/player";
import { template } from "../../../../shared/master/MsgAction";

export default async function (call: ApiCall<ReqUseAttBook, ResUseAttBook>) {
    call.succ({})
    let user = call.req._player as player;
    let res = user.check_wallet(0, 0, [{ id: call.req.id, v: call.req.num }], false, `使用${call.req.name}X${call.req.num}`, true);
    if (!res.state) {
        return;
    }
    user.P[call.req.key] += call.req.num;
    user.sendMsg(template.default,`属性提升完成`)
}